namespace DotNetNuke.Services.Scheduling
{
    using DotNetNuke.Services.Exceptions;
    using Microsoft.VisualBasic.CompilerServices;
    using System;

    public class PurgeScheduleHistory : SchedulerClient
    {
        public PurgeScheduleHistory(ScheduleHistoryItem objScheduleHistoryItem)
        {
            this.ScheduleHistoryItem = objScheduleHistoryItem;
        }

        public override void DoWork()
        {
            try
            {
                this.Progressing();
                SchedulingProvider.Instance().PurgeScheduleHistory();
                this.ScheduleHistoryItem.Succeeded = true;
                this.ScheduleHistoryItem.AddLogNote("Schedule history purged.");
            }
            catch (Exception exception1)
            {
                
                Exception exc = exception1;
                this.ScheduleHistoryItem.Succeeded = false;
                this.ScheduleHistoryItem.AddLogNote("Schedule history purge failed." + exc.ToString());
                this.ScheduleHistoryItem.Succeeded = false;
                this.Errored(ref exc);
                DotNetNuke.Services.Exceptions.Exceptions.LogException(exc);
                
            }
        }
    }
}

